const Router = require('koa-router')

const userRoute = require('./src/routes/usersRouter')
const loginRouter = require('./src/routes/loginRouter')
const blogRouter = require('./src/routes/blogRouter')
const personalCircleRouter = require('./src/routes/personalCircleRouter')
const messageBoardRouter = require('./src/routes/messageBoardRouter')
const DataStatisticRouter = require('./src/routes/DataStatisticRouter')
const indexRouter = new Router({
    prefix: '/api' //设置前缀
})

//注册子路由
// 用户
indexRouter.use('/users', userRoute.routes(), userRoute.allowedMethods())
// 登录
indexRouter.use('/login', loginRouter.routes(), userRoute.allowedMethods())
// 博客
indexRouter.use('/blog', blogRouter.routes(), userRoute.allowedMethods())
//个人圈
indexRouter.use('/personalCircle', personalCircleRouter.routes(), personalCircleRouter.allowedMethods())
//留言板
indexRouter.use('/messageBoard', messageBoardRouter.routes(), messageBoardRouter.allowedMethods())
//数据统计
indexRouter.use('/dataStatistic', DataStatisticRouter.routes(), DataStatisticRouter.allowedMethods())

module.exports = indexRouter
